//
//  ViewController.m
//  贝塞尔曲线
//
//  Created by 宜必鑫科技 on 2017/10/30.
//  Copyright © 2017年 宜必鑫科技. All rights reserved.
//

/**
 @property 的修饰符
 
 ARC下默认的基本类型
 @property （atomic, readwrite, assign）
 
 ARC下默认的对象类型
 @property  (atomic, readwrite, strong)
 
 2.setter相关修饰符：strong | weak  | assign | retain | copy
  strong 和 retain 基本差不多  不过修饰Block的时候 会出现问题
  copy copy修饰的必需遵循NSCopying协议 否则会崩溃异常 修饰不可变的 NSString  NSArray NSDictionary
  weak 修饰的必须是OC对象 然而在属性所指的对象遭到摧毁时，属性值也会清空(nil out)。
  assigin 可以用非OC对象 )的简单赋值操作
 
  NSInteger  有符号
  NSUInteger 无符号  即只表示正数
 sqrt 求平方根
 */


#import "ViewController.h"
#import "CYLUser.h"
#import <Masonry.h>
#import <ReactiveObjC.h>
#import "StudyController.h"
#import "SnowController.h"
#import "DuoLaAMengController.h"
#import "ThreeViewController.h"
#import "TwoViewController.h"
// 一般出现一个值
typedef  NS_ENUM(NSUInteger,Sex){
    WoMen = 0,
    Men   = 1,
};
//  位运算符  与 或 非  << 左移 高位丢弃 低位补0
//                    >> 右移 低位丢弃 高位有的补0 有的补运算位
typedef  NS_OPTIONS(NSUInteger,WJSex){
    WJWoMen = 0,
    WJMen   = 1 << 0,
    WJHaHa  = 1 << 1,
};


@interface ViewController ()
@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:button];
    [button mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.right.mas_equalTo(-10);
        make.top.mas_equalTo(100);
        make.height.mas_equalTo(50);
    }];
    [button setTitle:@"学习" forState:0];
    button.backgroundColor = [UIColor darkGrayColor];
    [[button rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
        StudyController *study = [[StudyController alloc]init];
        [self presentViewController:study animated:YES completion:nil];
    }];
    
    UIButton *button1 = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:button1];
    button1.backgroundColor = [UIColor darkGrayColor];
    [button1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.right.mas_equalTo(-10);
        make.top.equalTo(button.mas_bottom).offset(10);
        make.height.mas_equalTo(50);
    }];
    [button1 setTitle:@"雪山" forState:0];
    [[button1 rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
        SnowController *study = [[SnowController alloc]init];
        [self presentViewController:study animated:YES completion:nil];
    }];
    
    
    UIButton *button2 = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:button2];
    button2.backgroundColor = [UIColor darkGrayColor];
    [button2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.right.mas_equalTo(-10);
        make.top.equalTo(button1.mas_bottom).offset(10);
        make.height.mas_equalTo(50);
    }];
    [button2 setTitle:@"多啦A梦" forState:0];
    [[button2 rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
        DuoLaAMengController *study = [[DuoLaAMengController alloc]init];
        [self presentViewController:study animated:YES completion:nil];
    }];
    
    UIButton *button3 = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:button3];
    button3.backgroundColor = [UIColor darkGrayColor];
    [button3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.right.mas_equalTo(-10);
        make.top.equalTo(button2.mas_bottom).offset(10);
        make.height.mas_equalTo(50);
    }];
    [button3 setTitle:@"push屏幕旋转1" forState:0];
    [[button3 rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
        TwoViewController *study = [[TwoViewController alloc]init];
        [self.navigationController pushViewController:study animated:YES];
    }];
    
    UIButton *button4 = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:button4];
    button4.backgroundColor = [UIColor darkGrayColor];
    [button4 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.right.mas_equalTo(-10);
        make.top.equalTo(button3.mas_bottom).offset(10);
        make.height.mas_equalTo(50);
    }];
    [button4 setTitle:@"push屏幕旋转2" forState:0];
    [[button4 rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
        ThreeViewController *study = [[ThreeViewController alloc]init];
        [self.navigationController pushViewController:study animated:YES];
    }];
}



//是否可以旋转
- (BOOL)shouldAutorotate
{
    return YES;
}
//支持的方向 设置支撑竖屏
-(UIInterfaceOrientationMask)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait;
}


@end
